package com.ruoyi.framework.shiro.realm;

import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;

/**
 * @author liuhuicheng
 * @description: 微信小程序登录realm
 * @date 2023-10-17 21:13
 */
public class WeChatRealm extends AuthorizingRealm {
    @Override
    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
        // TODO 预见创建一个微信小程序角色，所有微信小程序用户都用该角色
        SimpleAuthenticationInfo info = new SimpleAuthenticationInfo();

        return null;
    }

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
        // TODO 接受穿回来的微信openid,调用微信接口判断是否正确，如果没有注册就注册，有则直接登录
        return null;
    }
}
